package procedureandconsumer;

public class ThreadConsumer extends Thread{
    private MyStack stack;
    public ThreadConsumer(MyStack stack){this.stack=stack;}

    @Override
    public void run() {
        while (true){
            System.out.println("消费者消费量一个产品,进行出栈操作");
            //出栈
            Object obj=stack.pop();
            if (obj==null){
                System.out.println("消费者没有消费到商品");
            }
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }
    }
}
